Configure Web Options

Source code

Copy code
'************************************************************************************************************************
'Description:
'
'This example opens the testing application and configures its Web options.
'
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtWebOptions 'As QuickTest.WebOptions ' Declare the Web Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.SetActiveAddins Array("Web") ' Activate the Web Add-in
qtApp.Launch ' Start the application
qtApp.Visible = True ' Make the application visible
qtApp.Open "C:\Tests\Test1", False 'Open a test so that you use the Web property to return the Web Options object

Set qtWebOptions = qtApp.Options.Web ' Return the Web Options object

' Configure the Web options
qtWebOptions.AddToPageLoadTime = 30 ' Set the time added to page load time to 30 seconds

' Configure advanced Web options
qtWebOptions.EnableBrowserResize = False ' Set to open the browser to its default size
qtWebOptions.RunUsingSourceIndex = True ' Set to use the source index property (for better performance)
qtWebOptions.UseAutoXPathIdentifiers = True ' Learn and use an XPath property during a run session
qtWebOptions.RunOnlyClick = True ' Set to run click events as MouseDown, MouseUp and Click
qtWebOptions.BrowserCleanup = True ' Set to close all open browsers when test/iteration finishes
qtWebOptions.RecordByWinMouseEvents = "OnClick OnMouseDown" ' Indicate for which events to use standard Windows events
qtWebOptions.RecordAllNavigations = True ' Set to record navigation each time the URL changes
qtWebOptions.RecordMouseDownAndUpAsClick = False ' Set to record MouseDown and MouseUp instead of Clicks
qtWebOptions.RecordCoordinates = False ' Do not record actual coordinates
If qtWebOptions.PageCreationMode = "URL" Then ' If optimizing Page object creation is currently selected (URL mode) then
    qtWebOptions.CreatePageUsingNonUserData = "Get" ' Ignore non-user data if using Get transfer method
    qtWebOptions.CreatePageUsingUserData = "Get Post" ' Ignore user data if using Get/Post transfer method
    qtWebOptions.CreatePageUsingAdditionalInfo = False ' Do not use additional properties to identify existing Page
End If
If qtWebOptions.FrameCreationMode = "URL" Then ' If optimizing Frame object creation is currently selected (URL mode) then
    qtWebOptions.CreateFrameUsingNonUserData = "Get" ' Ignore non-user data if using Get transfer method
    qtWebOptions.CreateFrameUsingUserData = "Get Post" ' Ignore user data if using Get/Post transfer method
    qtWebOptions.CreateFrameUsingAdditionalInfo = False ' Do not use additional properties to identify existing Frame
End If

Set qtWebOptions = Nothing ' Release the Web Options object
Set qtApp = Nothing ' Release the Application object